package red.mlz.module;

import com.alibaba.druid.filter.config.ConfigTools;

public class DruidConfigGenerator {
    public static void main(String[] args) throws Exception {
        String plainPassword = "123456";

        String[] keyPair = ConfigTools.genKeyPair(512);
        String privateKey = keyPair[0]; // 私钥
        String publicKey = keyPair[1];  // 公钥

        String encryptedPassword = ConfigTools.encrypt(privateKey, plainPassword);

        System.out.println("public-key=" + publicKey);
        System.out.println("spring.datasource.password=" + encryptedPassword);
    }
}
